﻿CreateGoogle(160,600,null,null,null,null,null,null,null,null);
function pageLoad(sender, args)
{
    $addHandler($get("btnSave"),"click",SaveFeed);
 
}
//保存用户反馈过来的信息
function SaveFeed()
{
    var vlid=true;
    showProgressBar(true);
    var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    $get("StxtContent").style.display='none';
    $get("StxtEmail").style.display='none';
    $get("SFeedBackCat").style.display='none';
    if($get("txtContent").value=="")
     {
        vlid=false;
        $get("StxtContent").style.display='';
     }
      if($get("FeedBackCat").value=="")
     {
        vlid=false;
        $get("SFeedBackCat").style.display='';
     }
     if($get("txtEmail").value=="")
     {
        vlid=false;
    $get("StxtEmail").style.display='';
    $get("StxtEmail").innerHTML=StxtEmail2;
     }else if($get("txtEmail").value.search(re))
     {
        vlid=false;
        $get("StxtEmail").style.display='';
        $get("StxtEmail").innerHTML=StxtEmail1;
     }
      if(!vlid){
    showProgressBar(false);
     return;}
       var Content=$get("txtContent").value;
       var Email=$get("txtEmail").value;
       var CateID=$get("FeedBackCat").value;
       var Name=$get("TextName").value;
       var PageUrl=$get("TextUrl").value;
       $get("btnSave").disabled = true;
       AddFeedBack( MemberNo,Email,Name,CateID,Content,PageUrl);
 }
 function AddFeedBack( MemberNo,Email,Name,CateID,Content,PageUrl)
 {

    WebServices.FeedBack.AddFeedBackCat(MemberNo,Email,Name,CateID,Content,PageUrl,onsucc);
 }
 function onsucc(result)
{ 
    if(result==1)
    {
     WebServices.FeedBack.sendmail(MemberNo,$get("TextName").value,$get("txtEmail").value);
    }
  showProgressBar(false);
    $get("btnSave").disabled = false;
    Rend("Tcontent");
  
}
//替换显示信息
function Rend(divID)
{
    var domDiv1 = $get(divID);
    if(domDiv1!=null)
    {
        if($get("content")==null) return;
        var item= $get("content").innerHTML;
        var listBuilder = new Sys.StringBuilder();
            listBuilder.append(item);
        domDiv1.innerHTML = listBuilder.toString();
   }
}


 if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
